/**
 * 扩展内置对象的方法
 */
// console.log(Array.prototype)
Array.prototype.sum = function() {
    return this.reduce((pre, next) => {
        return pre + next
    }, 0)
}

Object.prototype.MyKeys = function() {
    const keys = []
    for(let k in this) {
        if (k !== 'MyKeys') {
            keys.push(k)
        }
    }
    return keys;
}

const arr = [1,2,3,4];
const value = arr.sum()
console.log(value)

const obj = {
    a: 1,
    b: 2,
    c: 3
}
console.log(obj.MyKeys())